const app = getApp()
let qCloud = require("../../../index.js");
Page({

    /**
     * 页面的初始数据
     */
    data: {
        imgPath: qCloud.config.STATIC_IMAGE_PATH,
        enterpriseLogo: null,
        enterpriseLogoUrl: null,
        organName: null,
        enterpriseId: null,
        legalName: null,
        enterprisePhone: null,
        enterpriseEmail: null,
        officialWebsite: null,
        businessAddress: null,
    },

    onLoad: function (options) {
        let self = this;
        let userInfo = qCloud.session.getUser();
        self.setData({
            organName: userInfo.organName,
        });

        self.getEnterpriseInfo();

    },

    getEnterpriseInfo: function () {
        let self = this;
        app.fetchApis(self, qCloud.api.getEnterpriseInfo, {}, "GET", function (e) {
            let result = e.data;
            if (result.code == 200) {
                self.setData({
                    enterpriseId: result.data.enterpriseId,
                    enterpriseLogo: result.data.enterpriseLogo,
                    enterpriseLogoUrl: result.data.enterpriseLogoUrl,
                    legalName: result.data.legalName,
                    enterprisePhone: result.data.enterprisePhone,
                    enterpriseEmail: result.data.enterpriseEmail,
                    officialWebsite: result.data.officialWebsite,
                    businessAddress: result.data.businessAddress,
                })
            }
        });
    },

})
